#include"process.h"
#include<unistd.h>
//download

double bandwidth=1024*1024*1.0;
void download(double filesize, callback_t cb)
{
    double current = 0.0;
    printf("dowload begin, current:%lf\n",current);
    while(current<=filesize)
    {
        cb(filesize,current);
        //从网络中获取数据
        current+=bandwidth;
        usleep(100000);
    }
    printf("\ndowload done,filesize:%lf\n",filesize);
}

int main()
{
  //ForTest();
  //PocBar(100.0,56.90);
  download(100*1024*1024,ProcBar);
  return 0;
}
